/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/14 22:30
  *
  * @file       hd_key.h
  * @brief      Head file of KEY hardware driver.
  *
  * @note       This file contains the hardware driver's function declaration
  *             for the KEY.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date           Author       Notes
  *   2024/6/14      Chris        the first version
  *
  ******************************************************************************
  */

#ifndef JXTECH_KEY_H
#define JXTECH_KEY_H

#include "pd_gpio.h"


struct KeyVtbl;

// Object properties
typedef struct {
    struct KeyVtbl* vptr;
    GPIO* gpio;
} Key;

// Object virtual table
struct KeyVtbl {
    void (*init)(const Key* this);

    uint8_t (*get_num)(const Key* this);
};

// Object constructor and member function
void Key_constructor(Key* this, GPIO* gpio);

static inline void Key_init(const Key* this) {
    this->vptr->init(this);
}

static inline uint8_t Key_getNum(const Key* this) {
    return this->vptr->get_num(this);
}

#endif
